{php define('MUI', true);}
{template 'common/header'}
{if $do == 'receive_card'}
<div class="mui-content membership-card-receive">
	{if !empty($setting['grant']) && ($setting['grant']['credit1'] || $setting['grant']['credit2'] || !empty($coupon))}
	<div class="mui-bg-warning mui-text-center tips">
		领卡赠送:
		{if $setting['grant']['credit2'] > 0}
		￥<span class="mui-big">{$setting['grant']['credit2']}</span>
		{/if}
		{if $setting['grant']['credit1'] > 0}
		+ <span class="mui-big">{$setting['grant']['credit1']}</span>积分
		{/if}
		{if !empty($coupon_title)}
		卡券:{$coupon_title}
		{/if}
	</div>
	{/if}
	<div class="card-panel" style="background-image: url(
			{if empty($setting['background']['image'])}
			{php echo tomedia('images/global/card/1.png')}
			{elseif $setting['background']['background'] == 'system'}
			{php echo tomedia('images/global/card/' . $setting['background']['image'] . '.png')}
			{else}
			{php echo tomedia($setting['background']['image']);}
			{/if}
		);">
		<div class="card-logo mui-text-center">
			{if !empty($setting['logo'])}<img src="{php echo tomedia($setting['logo'])}" class="mui-img-rounded"/>{/if}
		</div>
		<div class="card-info">
			<div class="mui-text-center">
				<span class="vip" style="color:{if !empty($setting['color'])}{$setting['color']}{/if}">VIP</span>
				<span class="card-rank" style="color:{if !empty($setting['color'])}{$setting['color']}{/if}">{$_W['member']['groupname']}</span>
			</div>
			{if !$setting['format_type']}
			<div class="card-no mui-text-right">会员卡号:<span style="color: #fff;">{$setting['format']}</span></div>
			{/if}
		</div>
	</div>
	<form class="tab-content clearfix js-ajax-form" action="{url 'mc/card/receive_card'}" method="post" enctype="multipart/form-data">
		<div class="mui-input-group">
			<div class="mui-input-row">
				<label>
					姓名<span title="必填项" style="color:red">*</span>
				</label>
				{php echo tpl_app_fans_form('realname', $member_info['realname'], '姓名');}
			</div>
			<div class="mui-input-row">
				<label>
					手机<span title="必填项" style="color:red">*</span>
				</label>
				{php echo tpl_app_fans_form('mobile', $member_info['mobile'], '手机号码');}
			</div>
			{loop $setting['fields'] $item}
			{if $item['bind'] != 'realname' &&  $item['bind'] != 'mobile'}
			<div class="mui-input-row">
				<label>
					{$item['title']} {if $item['require'] == 1}<span title="必填项" style="color:red">*</span>{else} &nbsp;{/if}
				</label>
				{if $item['bind'] == 'reside' || $item['bind'] == 'resideprovince' || $item['bind'] == 'residecity' || $item['bind'] == 'residedist'}
				{php echo tpl_app_fans_form('reside', array('province' => $member_info['resideprovince'],'city' => $member_info['residecity'],'district' => $member_info['residedist']));}
				{elseif $item['bind'] == 'birth' || $item['bind'] == 'birthyear' || $item['bind'] == 'birthmonth' || $item['bind'] == 'birthday'}
				{php echo tpl_app_fans_form('birth', array('year' => $member_info['birthyear'], 'month' => $member_info['birthmonth'], 'day' => $member_info['birthday']))}
				{else}
				{php echo tpl_app_fans_form($item['bind'],$member_info[$item['bind']],$item['title'])}
				{/if}
			</div>
			{/if}
			{/loop}
		</div>
		<div class="mui-content-padded">
			<input type="hidden" name="token" value="{$_W['token']}" />
		<button class="mui-btn mui-btn-success mui-btn-block" id="receive-card" type="submit" name="submit" value="提交">领取</button>
	</div>
	</form>
</div>
{/if}
<!-- 我的会员卡 -->
{if $do == 'mycard'}
<style>
	.back pre{
		display: block;
		font-size: 13px;
		line-height: 1.42857143;
		color: #333;
		word-break: break-all;
		word-wrap: break-word;
		border-radius: 4px;
		padding: 0;
		margin: 0;
		border: 0;
		background: 0 0;
		white-space: pre-line;
		height: 84px;
		overflow: hidden;
	}
</style>
{if empty($mcard['status'])}
<div class="alert alert-warning" role="alert">
	您的会员卡已被禁用，如有疑问，请联系{$_W['account']['name']}。
</div>
{else}
<div class="mui-content membership-card-home mc-we7-home">
	<div class="card-panel prev" onclick="$(this).hide();$('.back').show()" style="background-image:url(
			{if empty($setting['background']['image'])}
			{php echo tomedia('images/global/card/1.png')}
			{elseif $setting['background']['background'] == 'system'}
			{php echo tomedia('images/global/card/' . $setting['background']['image'] . '.png')}
			{else}
			{php echo tomedia($setting['background']['image']);}
			{/if}
		)">
		<a href="javascript:;">
			<div class="card-logo mui-text-center">
				{if !empty($setting['logo'])}<img src="{php echo tomedia($setting['logo'])}" class="mui-img-rounded"/>{/if}
			</div>
			<div class="card-info">
				<div class="mui-text-center">
						<span class="vip" style="color:{if !empty($setting['color'])}{$setting['color']}{/if}">VIP</span>
						<span class="card-rank" style="color:{if !empty($setting['color'])}{$setting['color']}{/if}">{$_W['member']['groupname']}</span>
				</div>
					<div class="card-no mui-text-right">会员卡号:<span>{$mcard['cardsn']}</span></div>
			</div>
		</a>
	</div>
	<div class="card-panel back" style="display:none;background-image:url(
			{if empty($setting['background']['image'])}
			{php echo tomedia('images/global/card/1.png')}
			{elseif $setting['background']['background'] == 'system'}
			{php echo tomedia('images/global/card/' . $setting['background']['image'] . '.png')}
			{else}
			{php echo tomedia($setting['background']['image']);}
			{/if}
		)" onclick="$(this).hide();$('.prev').show()">
			<span>
				<h3 style="font-size:14px;font-weight:100;margin:10px 0;">使用说明：</h3>
				<pre>
				{if empty($setting['description'])}
				1、本卡采取记名消费方式
				2、持卡人可享受会员专属优惠
				3、本卡不能与其他优惠活动同时使用
				4、持卡人可用卡内余额进行消费
				{else}
				{$setting['description']}
				{/if}
				</pre>
			</span>
	</div>
	<div class="mui-table mui-table-inline mui-mt15 nav-action">
		<div class="mui-table-cell">
			<a href="{php echo url('entry', array('m' => 'recharge', 'do' => 'pay'));}" class="mui-block">
				<img src="resource/images/sum-recharge.png" alt="" class="mui-mr5"/>充值
			</a>
		</div>
		<div class="mui-table-cell">
			<a href="{php echo url('mc/card/consume') . 'wxref=mp.weixin.qq.com#wechat_redirect'}">
				<img src="resource/images/scan-pay.png" alt=""/>付款
			</a>
		</div>
	</div>
	<ul class="mui-table-view mui-table-view-chevron">
		<li class="mui-table-view-cell">
			<a href="{php echo url('entry', array('m' => 'recharge', 'do' => 'pay'));}" class="mui-navigate-right">
				我的余额
				<span class="mui-pull-right">{$_W['member']['credit2']}</span>
			</a>
		</li>
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/bond/credits', array('credittype' => 'credit1', 'type' => 'record', 'period' => '1'))}" class="mui-navigate-right">
				我的积分
				<span class="mui-pull-right">{$_W['member']['credit1']}</span>
			</a>
		</li>
		{if $setting['nums_status'] == 1}
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/recharge_record', array('type' => 'nums'))}" class="mui-navigate-right">
				{$setting['nums_text']}
				<span class="mui-pull-right">{$mcard['nums']}次</span>
			</a>
		</li>
		{/if}
		{if $setting['times_status'] == 1}
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/recharge_record', array('type' => 'times'))}" class="mui-navigate-right">
				{$setting['times_text']}
				<span class="mui-pull-right">{if $mcard['endtime'] < time()}已过期{else}{php echo date('Y-m-d', $mcard['endtime']);}{/if}</span>
			</a>
		</li>
		{/if}
		<li class="mui-table-view-cell">
			<a href="{php echo url('activity/coupon/mine')}" class="mui-navigate-right">
				我的卡券
				<span class="mui-pull-right">{$total}张</span>
			</a>
		</li>
	</ul>
	<ul class="mui-table-view mui-table-view-chevron">
		{if !empty($setting['sign_status'])}
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/sign_display') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">
				签到
			</a>
		</li>
		{/if}
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/notice') . 'wxref=mp.weixin.qq.com#wechat_redirect'}" class="mui-navigate-right">
				消息
			</a>
		</li>
	</ul>
	<ul class="mui-table-view mui-table-view-chevron">
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/personal_info') . 'wxref=mp.weixin.qq.com#wechat_redirect';}" class="mui-navigate-right">
				个人信息
			</a>
		</li>
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/bond/credits', array('credittype' => 'credit2', 'type' => 'record', 'period' => '1'))}" class="mui-navigate-right">
				账单
			</a>
		</li>
	</ul>
	{if !empty($activity_description_show)}
	<ul class="mui-table-view mui-table-view-chevron">
		<li class="mui-table-view-cell">
			<a href="{php echo url('mc/card/activity_description') . 'wxref=mp.weixin.qq.com#wechat_redirect';}" class="mui-navigate-right">
				优惠说明
			</a>
		</li>
	</ul>
	{/if}
</div>
{/if}
{/if}

{if $do == 'activity_description'}
<div class="mui-content">
	<ul class="mui-table-view mui-table-view-chevron">
		{if $activity_info['params']['discount_type'] != 0}
		<li class="mui-table-view-cell js-activity-descrpition">
			消费优惠信息
			<span class="mui-pull-right">
				<span class="fa fa-angle-down">
			</span>
		</li>
		<div style="display:none;">
			<ul class="mui-table-view mui-table-view-chevron">
				{loop $activity_description $description}
				<li class="mui-table-view-cell mui-content-padded">
					{$description[0]}
					<span style="margin-left:50px;" class="mui-text-center">{$description[1]}</span>
				</li>
				{/loop}
			</ul>
			{if $activity_info['params']['discount_style'] == 2}
			<div style="background-color:{$activity_info['params']['bgColor']}">{$activity_info['params']['content']}</div>
			{/if}
		</div>
		{/if}
		{if $recharge_info['params']['recharge_type'] != 0}
		<li class="mui-table-view-cell js-activity-descrpition">
			充值优惠信息
			<span class="mui-pull-right">
				<span class="fa fa-angle-down">
			</span>
		</li>
		<div style="display:none;">
			<ul class="mui-table-view mui-table-view-chevron">
				{loop $recharge_description $description}
				<li class="mui-table-view-cell mui-content-padded mui-text-center">
					<span style="margin-left:50px;">
					{$description}
					</span>
				</li>
				{/loop}
			</ul>
		</div>
		{/if}
		{if $nums_info['params']['nums_status'] != 0}
		<li class="mui-table-view-cell js-activity-descrpition">
			{$nums_info['params']['nums_text']}信息
			<span class="mui-pull-right">
				<span class="fa fa-angle-down">
			</span>
		</li>
		<div style="display:none;">
			<ul class="mui-table-view mui-table-view-chevron">
				{loop $nums_description $description}
				<li class="mui-table-view-cell mui-content-padded mui-text-center">
					<span>
					{$description}
					</span>
				</li>
				{/loop}
			</ul>
			{if $nums_info['params']['nums_style'] == 2}
			<div style="background-color:{$nums_info['params']['bgColor']}">{$nums_info['params']['content']}</div>
			{/if}
		</div>
		{/if}
		{if $times_info['params']['times_status'] != 0}
		<li class="mui-table-view-cell js-activity-descrpition">
			{$times_info['params']['times_text']}信息
			<span class="mui-pull-right">
				<span class="fa fa-angle-down">
			</span>
		</li>
		<div style="display:none;">
			<ul class="mui-table-view mui-table-view-chevron">
				{loop $times_description $description}
				<li class="mui-table-view-cell mui-content-padded mui-text-center">
					<span>
					{$description}
					</span>
				</li>
				{/loop}
			</ul>
			{if $times_info['params']['times_style'] == 2}
			<div style="background-color:{$times_info['params']['bgColor']}">{$times_info['params']['content']}</div>
			{/if}
		</div>
		{/if}
	</ul>
</div>
<script>
	$('.js-activity-descrpition').click(function() {
		$(this).next().toggle();
		$(this).find('span.fa').toggleClass('fa-angle-up');
		$(this).find('span.fa').toggleClass('fa-angle-down');
	})
</script>
{/if}

{if $do == 'add_recharge'}
<div class="mui-content membership-card-add-times">
	<div class="mui-section mui-text-center">
		请选择您要增加的{if $type == 'nums'}次数{elseif $type == 'times'}时间{/if}
	</div>
	<div class="mui-row mui-mr5 mui-ml5">
		{php $i = 0;}
		{loop $setting $nums}
		<div class="mui-col-xs-4 mui-pa5 mui-mt5">
			<div class="mui-thumbnail mui-text-center mui-text-info {if $i == '0'}selected{/if}" data-nums="{if $type == 'nums'}{$nums['num']}{elseif $type == 'times'}{$nums['time']}{/if}" data-recharge="{$nums['recharge']}">
				<div class="mui-big">{if $type == 'nums'}{php echo $nums['num'] . '次'}{elseif $type == 'times'}{php echo $nums['time'] . '天'}{/if}</div>
				<div class="mui-small">{$nums['recharge']}元</div>
				<div class="selected-status"></div>
			</div>
		</div>
		{php $i++;}
		{/loop}
	</div>
	<ul class="mui-table-view">
		<li class="mui-table-view-cell">
			实际增加的{if $type == 'nums'}次数{elseif $type == 'times'}时间{/if} <span class="mui-pull-right add-nums"></span>
		</li>
		<li class="mui-table-view-cell">
			需要支付的金额 <span class="mui-pull-right mui-text-success mui-big add-pay"></span>
		</li>
	</ul>
	<div class="mui-content-padded">
		<a class="mui-btn mui-btn-success mui-btn-block dopay" href="javascript:;">确认支付</a>
	</div>
</div>
<script>
	$(function(){
		$('.mui-thumbnail').click(function(){
			$('.mui-thumbnail').removeClass('selected');
			$(this).addClass('selected');
			var type = '{$type}';
			var addnums = $(this).data('nums');
			var addpay = $(this).data('recharge');
			var status = '<div class="selected-status"></div>';

			if (type == 'nums') {
				$('.add-nums').text(addnums + '次');
				url = "{php echo url('entry', array('m' => 'recharge', 'do' => 'pay', 'type' => 'card_nums'), true)}&fee=" + addpay;
			} else if(type == 'times') {
				$('.add-nums').text(addnums + '天');
				url = "{php echo url('entry', array('m' => 'recharge', 'do' => 'pay', 'type' => 'card_times'), true)}&fee=" + addpay;
			}
			$('.add-pay').text(addpay + '元');
			$('.dopay').attr('href', url);
		})
		$('.mui-thumbnail:first').click();
	})
</script>
{/if}

{if $do == 'recharge_record'}
<!-- 查看剩余次数或天数 -->
<div class="mui-content membership-card-times">
	<div class="mui-section">
		<div class="mui-text-success mui-text-center times">{if $type == 'nums'}{$card['nums']}{elseif $type == 'times'}{php echo date('Y-m-d', $card['endtime'])}{/if}</div>
		<div class="mui-text-center mui-text-muted">{if $type == 'nums'}{$setting['nums_text']}{elseif $type == 'times'}{$setting['times_text']}{/if}</div>
		{if $type == 'nums'}
		<a class="mui-btn mui-btn-success mui-btn-outlined mui-btn-block" href="{php echo url('mc/card/add_recharge', array('type' => 'nums'));}">立即充值</a>
		{elseif $type == 'times'}
		<a class="mui-btn mui-btn-success mui-btn-outlined mui-btn-block" href="{php echo url('mc/card/add_recharge', array('type' => 'times'));}">立即充值</a>
		{/if}
	</div>
	<ul class="mui-table-view">
		<li class="mui-table-view-cell">
			<div class="mui-row">
				<div class="mui-col-xs-3">
					<a href="#times-date">
						<span class="date-filter">{$period_date}</span>
						<span class="mui-text-muted"><i class="fa fa-angle-down"></i></span>
					</a>
				</div>
			</div>
		</li>
		{loop $data $da}
		<li class="mui-table-view-cell">
			<div class="mui-row">
				<div class="mui-col-xs-6">
					{if $type == 'nums'}
					{if $da['model'] == '1'}
					次数充值
					{else}
					次数消费
					{/if}
					{else}
					{if $da['model'] == '1'}
					服务延长
					{else}
					服务减少
					{/if}
					{/if}
					<span class="mui-block mui-text-muted mui-small"> <span class="mui-ml5 mui-rmb">{$da['fee']}</span></span>
				</div>
				<div class="mui-col-xs-6 mui-text-right">
					<span class="mui-big">{if $da['model'] == '1'}+{else}-{/if}{$da['tag']}{if $type == 'nums'}次{elseif $type == 'times'}天{/if}</span>
					<span class="mui-block mui-text-muted mui-small">{php echo date('Y-m-d', $da['addtime'])}</span>
				</div>
			</div>
		</li>
		{/loop}
	</ul>
	<div id="times-date" class="mui-popover mui-popover-top">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/recharge_record', array('period' => '1', 'type' => $type));}">{php echo date('Y.m', strtotime('now'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/recharge_record', array('period' => '-1', 'type' => $type));}">{php echo date('Y.m', strtotime('now - 1 month'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/recharge_record', array('period' => '-2', 'type' => $type));}">{php echo date('Y.m', strtotime('now - 2 month'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/recharge_record', array('period' => '-3', 'type' => $type));}">{php echo date('Y.m', strtotime('now - 3 month'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/recharge_record', array('period' => '-4', 'type' => $type));}">{php echo date('Y.m', strtotime('now - 4 month'))}</a>
			</li>
		</ul>
	</div>
</div>

{/if}

{if $do == 'sign_display'}
<!--签到界面-->
<div class="mui-content membership-card-sign mui-text-center">
	<div class="mui-table mui-table-inline nav-action">
		<div class="mui-table-cell">
			<a href="{php echo url('mc/card/sign_record', array('period' => '1'))}" class="mui-block">
				<img src="resource/images/icon-sign.png" alt="" />
				签到记录
			</a>
		</div>
		<div class="mui-table-cell">
			<a href="{php echo url('mc/card/sign_strategy')}" class="mui-block">
				<img src="resource/images/icon-integral-strategy.png" alt="" />
				积分攻略
			</a>
		</div>
	</div>
	<div class="sign-table">
		<div class="mui-bg-white sign-table-con mui-clearfix">
			{php for ($i = 1; $i <= $current_month_days; $i++) {}
			{if $i == $sign_set['first_group_day']}
			<div class="sign-table-cell {if $i <= $total}active{/if}">
				<span><img src="resource/images/icon-signed-5.png" alt="" class="{if $i > $total}gray-img{/if} signed-5"/></span>
				+{$sign_set['first_group_num']}
			</div>
			{elseif $i == $sign_set['second_group_day']}
			<div class="sign-table-cell {if $i <= $total}active{/if}">
				<span><img src="resource/images/icon-signed-5.png" alt="" class="{if $i > $total}gray-img{/if} signed-5"/></span>
				+{$sign_set['second_group_num']}
			</div>
			{elseif $i == $sign_set['third_group_day']}
			<div class="sign-table-cell {if $i <= $total}active{/if}">
				<span><img src="resource/images/icon-signed-5.png" alt="" class="{if $i > $total}gray-img{/if} signed-5"/></span>
				+{$sign_set['third_group_num']}
			</div>
			{elseif $i == $current_month_days}
			<div class="sign-table-cell {if $i <= $total}active{/if}">
				<span><img src="resource/images/icon-signed-5.png" alt="" class="{if $i > $total}gray-img{/if} signed-5"/></span>
				+{$sign_set['full_sign_num']}
			</div>
			{else}
			<div class="sign-table-cell {if $i <= $total}active{/if}">
				<span><img src="resource/images/icon-signed.png" alt="" class="{if $i > $total}gray-img{/if}"/></span>
				+{$sign_set['everydaynum']}
			</div>
			{/if}
			{php }}
		</div>
	</div>
	{if !empty($today_signed['id'])}
	<div class="sign-record">今日已签到<span class="mui-big">+{$today_sign_credit}</span>积分</div>
	<div class="mui-text-muted sign-tips mui-mt10">明日可得 <span>+{$tomorrow_sign_credit}</span>积分</div>
	{/if}
</div>
<script>
	$(function() {
		today_signed = "{$today_signed['id']}";
		if (!today_signed) {
			util.toast('签到成功');
			setTimeout(function(){
				location.reload();
			},2500);
		}
	})
</script>
{/if}

{if $do == 'sign_record'}
<!--签到记录-->
<div class="mui-content">
	<div class="mui-content-padded">
		<a href="#sign-date"  class="mui-text-muted">
			<span>{if $_GPC['period'] <= 0}{php echo date('Y.m', strtotime($_GPC['period'] . 'month'))}{else}查看全部{/if}</span>
			<span><i class="fa fa-angle-down"></i></span>
		</a>
	</div>
	<div class="credits-display">
		<ul class="mui-table-view js-card-sign">
			{if !empty($data)}
			{loop $data $da}
			<li class="mui-table-view-cell">
				<div class="mui-row">
					<div class="mui-col-xs-6">
						{$da['addtime']}
						<span class="mui-block mui-text-muted mui-small">签到送积分</span>
					</div>
					<div class="mui-col-xs-6 mui-text-right mui-big">
						+{$da['credit']}
					</div>
				</div>
			</li>
			{/loop}
			{else}
			<li class="mui-table-view-cell">
				<div class="mui-row">无签到记录</div>
			</li>
			{/if}
		</ul>
	</div>
	<div id="sign-date" class="mui-popover mui-popover-top">
		<ul class="mui-table-view">
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/sign_record', array('period' => '1'))}">查看全部</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/sign_record', array('period' => '0'))}">{php echo date('Y.m', strtotime('today'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/sign_record', array('period' => '-1'))}">{php echo date('Y.m', strtotime('-1month'))}</a>
			</li>
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/card/sign_record', array('period' => '-2'))}">{php echo date('Y.m', strtotime('-2month'))}</a>
			</li>
		</ul>
	</div>
</div>
<script>
	require(['mui.pullrefresh'], function(mui) {
		mui.init();
		mui.ready(function() {
			var page = 2;
			var pagetotal = {$pagenums} + 1;
			if (page < pagetotal) {
				//循环初始化所有下拉刷新，上拉加载。
				mui.each(document.querySelectorAll('.credits-display'), function(index, pullRefreshEl) {
					mui(pullRefreshEl).pullToRefresh({
						up: {
							callback: function() {
								var self = this;
								setTimeout(function() {
									$('.mui-pull-bottom-tips').hide();
									var ul = self.element.querySelector('.js-card-sign');
									ul.appendChild(createFragment(ul, index, 5));
									if (pagetotal <= page) {
										$('.mui-pull-bottom-tips').hide();
										self.endPullUpToRefresh(true);
									} else {
										self.endPullUpToRefresh(false);
									}
								}, 1000);
							}
						}
					});
				});

				var createFragment = function(ul, index, count, reverse) {
					var length = ul.querySelectorAll('li').length;
					var fragment = document.createDocumentFragment();
					var li;
					var url = "{php echo url('mc/card/sign_record', array('period' => $_GPC['period']), true)}";
					mui.post(url, {'page' : page}, function(data){
						data = $.parseJSON(data);
						if (data.message.errno == '1') {
							return false;
						}
						for (var i in data.message.message) {
							var href = "{php echo url('mc/bond/credits', array('type' => 'recorddetail', 'credittype' => $_GPC['credittype']),true)}";
							li = document.createElement('li');
							li.className = 'mui-table-view-cell';
							li.innerHTML = '<div class="mui-row"><div class="mui-col-xs-6">' + data.message.message[i].addtime + '<span class="mui-block mui-text-muted mui-small">签到送积分</span></div><div class="mui-col-xs-6 mui-text-right mui-big">+' +data.message.message[i].credit + '</div></div>';
							ul.appendChild(li, ul.firstChild);
						}
						$('.mui-pull-bottom-tips').show();
					});
					page++;
					return fragment;
				};
			}
		});
	});
</script>
{/if}

{if $do == 'sign_strategy'}
<div class="mui-content membership-card-integral-strategy">
	<div class="mui-big mui-text-info mui-text-center mui-mt15">积分攻略</div>
	<div class="mui-content-padded">
		{$content}
	</div>
</div>
{/if}

{if $do == 'notice'}
<div class="mui-content">
	<div class="mui-content-padded">
		<div id="segmentedControl" class="mui-segmented-control mui-segmented-control-info">
			<a class="mui-control-item mui-active" href="#broadcast">广播</a>
			<a class="mui-control-item" href="#system-message">系统消息</a>
		</div>
	</div>
	<div id="broadcast" class="mui-control-content mui-active">
		<ul class="mui-table-view mui-table-view-chevron">
			{if !empty($data)}
			{loop $data $da}
			{if $da['type'] == '1'}
			<li class="mui-table-view-cell mui-media js-read" data-isnew="{$da['is_new']}" data-id="{$da['id']}">
				<a href="javascript:;" class="mui-navigate-right">
					<img class="mui-media-object mui-pull-left" src="{php echo tomedia($da['thumb']);}">
					<div class="mui-media-body">
						<p class="mui-ellipsis">{$da['title']}</p>
						<div class="mui-small mui-text-muted">{php echo date('Y-m-d H:i', $da['addtime']);}</div>
					</div>
				</a>
				<div style="display:none;" class="js-content">
					<p>
						{$da['content']}
					</p>
				</div>
			</li>
			{/if}
			{/loop}
			{else}
			<li class="mui-table-view-cell mui-media"><i class="fa fa-info-circle"></i> 暂无消息</li>
			{/if}
		</ul>
	</div>
	<div id="system-message" class="mui-control-content">
		<ul class="mui-table-view mui-table-view-chevron">
			<li class="mui-table-view-cell mui-media">暂无消息</li>
		</ul>
	</div>
</div>
<script>
	$(document).on('click', '.mui-control-item', function() {
		$('.mui-backdrop').remove();
	})
	$('.js-read').click(function(){
		$(this).find('.js-content').toggle();
		//设置为已读
		if($(this).data('isnew')) {
			var id = $(this).data('id');
			$.post("{php echo url('mc/card/notice')}", {'id':id}, function(data){
				if(data != 0) {
					$('.nav-group .notice-count em').html(data);
				} else {
					$('.nav-group .notice-count em').remove();
				}
			});
			return false;
		}
	});
</script>
{/if}

{if $do == 'personal_info'}
<form class="tab-content clearfix js-ajax-form {if $_W['container'] !== 'wechat'}profile-form{/if}" action="{url 'mc/profile/editprofile'}" method="post" enctype="multipart/form-data">
	<div class="mui-content">
		<ul class="mui-table-view mui-table-view-chevron">
			<li class="mui-table-view-cell">
				<a href="{php echo url('mc/bond/mobile', array('op' => 'index'))}" class="mui-navigate-right">
					手机
					<span class="mui-pull-right"><span class="mui-mr10">{if empty($_W['member']['mobile'])}请绑定手机号{else}{$_W['member']['mobile']}{/if}</span></span>
				</a>
			</li>
		</ul>
		<div class="mui-input-group mui-mt15">
			{loop $mc_fields $fields}
			<div class="mui-input-row">
				<label>{php echo $fields['title']}</label>
				{if $fields['bind'] == 'birth'}
				{php echo tpl_app_fans_form('birth', array('year' => $profile['birthyear'], 'month' => $profile['birthmonth'], 'day' => $profile['birthday']), $fields['title']);}
				{else if $fields['bind'] == 'reside'}
				{php echo tpl_app_fans_form('reside', array('province' => $profile['resideprovince'], 'city' => $profile['residecity'], 'district' => $profile['residedist']), $fields['title']);}
				{else}
				{php echo tpl_app_fans_form($fields['bind'], $profile[$fields['bind']], $fields['title']);}
				{/if}
			</div>
			{/loop}
		</div>
		<div class="mui-content-padded">
			<div class="mui-text-center mui-mt15 mui-mb15">
				开卡时间:{php echo date('Y-m-d', $mcard['createtime']);}
			</div>
			<button class="mui-btn mui-btn-success mui-btn-block" type="submit" value="提交" name="submit">保存</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</div>
</form>
{/if}
{template 'common/footer'}